• Deep Sleep Summary

    Discussion deep sleep pysense pytrack deepsleep
    34
    7 Votes
    34 Posts
    11k Views
    philwilkinsonP
    @tuftec, yes you are correct, the machine.deepsleep() machine.remaining_sleep_time() and pin_deepsleep_wakeup() functions all work fine. I have isolated my problem was with the LoRa publishing code. When I commented out the lora_publish in my code below everything worked fine. The bug must be something to do with nvram functions i am using in my lora_publish function. Perhaps this bug is best published in a new thread. Thanks for the comment. Code published to allow others a quick start! import machine import utime from machine import Pin import pycom import config #user defined #import LoRa_publish #user defined rst=machine.reset_cause() if rst != 3: # if not woken from deepsleep utime.sleep(10) #to allow ctrl+C pycom.nvs_set('counter', 0) #button = Pin('P23', mode = Pin.IN, pull = Pin.PULL_UP) machine.pin_deepsleep_wakeup(pins = ['P23'], mode = machine.WAKEUP_ALL_LOW, enable_pull = True) machine.deepsleep(60000) else: if (machine.wake_reason()[0])==1: #pin wakeup total_count = pycom.nvs_get('counter') +1 pycom.nvs_set('counter', total_count) print('remaining deepsleep time is {}'.format(machine.remaining_sleep_time())) machine.pin_deepsleep_wakeup(pins = ['P23'], mode = machine.WAKEUP_ALL_LOW, enable_pull = True) machine.deepsleep(machine.remaining_sleep_time()) elif (machine.wake_reason()[0])==2: #RTC timer complete print('timer completed') total_count = pycom.nvs_get('counter') print('counted {} button presses'.format(total_count)) #LoRa_publish.publish(total_count) #INT published to TTN pycom.nvs_set('counter', 0) machine.pin_deepsleep_wakeup(pins = ['P23'], mode = machine.WAKEUP_ALL_LOW, enable_pull = True) machine.deepsleep(60000) #this does not restart a new interval!!
  • 0 Votes
    3 Posts
    1k Views
    C
    @jmarcelino hi , yes! Was about reading one ultrasonic sensor. Problem was fixed by using two other pins for sensor connecting. First was P11 and P12 and i did move to P21 and P22. I can not explain why...but seems work.
  • Deep Sleep Shield Update

    Announcements & News deep sleep library
    22
    3 Votes
    22 Posts
    11k Views
    ledbelly2142L
    @lambda280 I am using @Butch 's BME280 lib from HERE If I can get away with using P10 sequentially I will. Moving SCL to another pin is a great alternative. My BME280's are pretty close, about 5cm, but they are plugged into the LoPy expansion shield pin headders, which have some 'play' in them (not a solid connection). I would prefer to solder them somewhere for impact testing. What's hot glue for anyway :-) I'm using a fully made breakout BME280 board from HERE @jmarcelino thought moving the I2C pins is best, since you can't move the deep sleep shield pin 10. -Thank you! in the main.py I added the pin assignment: i2c = I2C(0, I2C.MASTER, baudrate=100000, pins=('P8','P9')) Works fine now.
  • Deep sleep / standby power consumption

    Getting Started deep sleep
    8
    0 Votes
    8 Posts
    2k Views
    D
    Hi @bucknall, I need some help with the Pysense deep sleep mode. I have a SiPy + Pysense + 3.7 V LiPo battery. I'm testing Deep sleep mode from last version of Pysense library but the multimeter is showing high deep sleep current consumption. SiPy firmware: 1.18.0 Pysense firmware: 0.0.8 My program disabled WiFi in boot.py. In main.py It blinks an LED for 5 seconds and then sleeps 20 seconds. These are my results: Blinking: ~50 mA Deep sleep: ~2.2 mA main.py code: from pysense import Pysense import pycom import time py = Pysense() #Turn-of heartbeat if pycom.heartbeat() == True: pycom.heartbeat(False) for i in range(5): pycom.rgbled(0x1F) time.sleep(0.05) pycom.rgbled(0x00) time.sleep(1) #Sleep 20 seconds py.setup_sleep(20) py.go_to_sleep() Is there any piece of code I'm missing? If pysense_0.0.4 dfu firmware resolves the deep sleep issue It's supposed to be ok with 0.0.8 too.
  • 0 Votes
    9 Posts
    1k Views
    S
    @livius I am using the official library taken from here https://github.com/pycom/pycom-libraries/blob/master/shields/lib/LTR329ALS01.py which indeed as you noticed does not contain the ALS_STATUS status register reading logic. According to the datasheet https://www.mouser.com/datasheet/2/239/Lite-On_LTR-329ALS-01 DS_ver1.1-348647.pdf Page 22 the Device operation flow chard shows indeed kind of a loop until that status register indicate a new data is available. on Page 24 it shows a pseudo code mentioning what you are suggesting (which is checking the data readiness before performing the actual read). Page 21 it describe how to perform the check of the validity of the read. I can try to patch the lib according to such information and push a PR to the official repo if this is solving the problem :-). Keep You posted and thanks for your help! Stef
  • 2 Votes
    24 Posts
    12k Views
    P
    @dbrgn Thanks for the notification, I can confirm that it works!
  • 1 Votes
    9 Posts
    4k Views
    J
    @chrisi if you are using the Deep Sleep shield, then you have the relevant functions in the library that goes with it. If you are using a Pysense (and I believe the same applies to the Pytrack), then it's a lot more complex. There's only one usable pin on the I/O header, you need to patch the Pysense firmware, isolate a pin between the module and the Pysense, and change a few things in the sleep process. But it does work. Refer to https://forum.pycom.io/topic/1673/pysense-pinout-wake-on-pin/16 for details.
  • Deep Sleep not working

    LoPy lopy pysense deep sleep sleep
    8
    0 Votes
    8 Posts
    3k Views
    Charly86C
    @dbrgn I'm having the same issue and I can reproduce it even with all latest firmware So to get back to your original question, is there a way to reset PIC with a Lopy GPIO, ie in case of I2C Error, reset the PIC should recover. Can we locate the PIC reset pin on the PySense/PyTrack boards? I would like to solder a wire from LoPy GPIO on it. It's difficult to tell our customers to recycle power on devices located in the field.